package com.fan.shop.services;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import org.springframework.transaction.annotation.Transactional;

import com.fan.shop.businesslogic.MessageRetriveProc;
import com.fan.shop.global.ShopGlobalVariables;
import com.fan.shop.model.userclass.MessageUserClass;

@Named("messageService")
@Transactional(readOnly = true)
public class MessageServiceImpl implements MessageService {
	
	@Inject
	@Named("stockService")
	private StockService stockService;
	
	@Inject
	@Named("purchaseOrderService")
	private PurchaseOrderService purchaseOrderService;
	
	@Inject
	@Named("stockReqService")
	private StockReqService stockReqService;
	
	@Inject
	@Named("shopGlobalService")
	private ShopGlobalService shopGlobalService;

	
	public MessageServiceImpl() {
		super();
		// TODO Auto-generated constructor stub
	}

	public List getList() {
		// TODO Auto-generated method stub
		return null;
	}

	public List<String> getColumnNames() {
		// TODO Auto-generated method stub
		return null;
	}

	public int getColumnsSize() {
		// TODO Auto-generated method stub
		return 0;
	}

	public Object copy(Object obj) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<MessageUserClass> getStockMessageList() {
		MessageRetriveProc messageRetriveProc = new MessageRetriveProc();
		messageRetriveProc.setStockService(stockService);
		messageRetriveProc.setShopGlobalService(shopGlobalService);
		int result = messageRetriveProc.getStocksMessage();
		if(result == ShopGlobalVariables.SUCCESS)
		{
			return messageRetriveProc.getStockMessagesList();
		}
		return null;
	}

	public List<MessageUserClass> getPOMessageList() {
		MessageRetriveProc messageRetriveProc = new MessageRetriveProc();
		messageRetriveProc.setPurchaseOrderService(purchaseOrderService);
		messageRetriveProc.setShopGlobalService(shopGlobalService);
		int result = messageRetriveProc.getPOsMessage();
		if(result == ShopGlobalVariables.SUCCESS)
		{
			return messageRetriveProc.getPoMessagesList();
		}
		return null;
	}

	public List<MessageUserClass> getSTREQMessageList() {
		MessageRetriveProc messageRetriveProc = new MessageRetriveProc();
		messageRetriveProc.setStockReqService(stockReqService);
		messageRetriveProc.setShopGlobalService(shopGlobalService);
		int result = messageRetriveProc.getStReqsMessage();
		if(result == ShopGlobalVariables.SUCCESS)
		{
			return messageRetriveProc.getStreqMessageList();
		}
		return null;
	}

	public StockService getStockService() {
		return stockService;
	}

	public void setStockService(StockService stockService) {
		this.stockService = stockService;
	}

	public ShopGlobalService getShopGlobalService() {
		return shopGlobalService;
	}

	public void setShopGlobalService(ShopGlobalService shopGlobalService) {
		this.shopGlobalService = shopGlobalService;
	}

}
